<template>
  <view>
    <xiri-account-tabbar
      @tabSwitch="tabSwitch"
      ref="accountTabbar"
    ></xiri-account-tabbar>
    <view>
      <account v-if="currentPage == 0" :height="height"></account>
      <newAccount
        v-else-if="currentPage == 1"
        :height="height"
        @back="switchToAccount"
      ></newAccount>
    </view>
  </view>
</template>

<script>
import { xiriAccountTabbar } from "./components/xiri-account-tabbar";
import { account } from "./account/index";
import { newAccount } from "./newAccount/index";

export default {
  components: {
    xiriAccountTabbar,
    account,
    newAccount,
  },
  data() {
    return {
      currentPage: 0,
      height: 0,
    };
  },
  methods: {
    tabSwitch(e) {
      this.currentPage = e;
      console.log(e);
    },
    switchToAccount() {
      this.$refs.accountTabbar.tabbarChange({ detail: 0 });
    },
  },
  created() {
    var info = uni.getSystemInfoSync();
    var height = info.windowHeight - 50;
    this.height = height;
    console.log(height);
  },
};
</script>

<style></style>
